#include "dishdetail.h"
#include "ui_dishdetail.h"
#include "QVBoxLayout"
#include "QLabel"
DishDetail::DishDetail(QWidget *parent,QString name,QString material,QString detail,QString imgURL,QString type) :
    QDialog(parent),
    ui(new Ui::DishDetail)
{
    ui->setupUi(this);
    ui->name->setText(name);
    ui->type->setText(type);
    ui->image->showURLImage(imgURL);
    QFont font("SimSun",15);
    QVBoxLayout* materialLayout = new QVBoxLayout(ui->material);
    QStringList materialList = material.split("|");
    for(int i = 0 ;i < materialList.size();++i)
    {
        QLabel* materialLabel = new QLabel(materialList.at(i));
//        materialLabel->setMinimumHeight(30);
        materialLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
        materialLabel->setFont(font);
//        materialLabel->setFrameShape(QFrame::StyledPanel);
        materialLayout->addWidget(materialLabel);
    }
    ui->material->setLayout(materialLayout);

    QVBoxLayout* detailLayout = new QVBoxLayout(ui->detail);
    QStringList detailList = detail.split("|");
    for(int i = 0 ;i < detailList.size();++i)
    {
        QLabel* detailLabel = new QLabel("第"+QString::number(i+1)+"步："+detailList.at(i));
//        detailLabel->setFrameShape(QFrame::StyledPanel);
        detailLabel->setAlignment(Qt::AlignVCenter);
        detailLabel->setWordWrap(true);
        detailLabel->setFont(font);
        detailLayout->addWidget(detailLabel);
    }
    ui->detail->setLayout(detailLayout);


}

DishDetail::~DishDetail()
{
    delete ui;
}
